{block name="style"}
{/block}
{block name="content"}
<form class="layui-form" action="{:url('/order/manager/order_return')}" method="post" id="order-return">
    <input type="hidden" name="order_id" value="{$order.order_id}">
    <div class="info-header">
        <div class="layui-row">
            <div class="layui-col-xs3">
                <label class="layui-form-label">平台</label>
                <div class="layui-input-block">
                    <input type="text" value="{$order.platform_name}" disabled class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">账号</label>
                <div class="layui-input-block">
                    <input type="text" value="{$order.account.username}" disabled class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">订单号</label>
                <div class="layui-input-block">
                    <input type="text" value="{$order.order_no}" disabled class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">下单日期</label>
                <div class="layui-input-block">
                    <input type="text" value="{$order.order_source_create_time}" disabled class="layui-input">
                </div>
            </div>
        </div>
    </div>
    <div class="info-body">
        <div class="layui-row">
            <div class="layui-col-xs3">
                <label class="layui-form-label xrequired">收货仓库</label>
                <div class="layui-input-block">
                    <select name="in_id" lay-search>
                        <option value="">请选择</option>
                        {foreach $warehouse as $w}
                        <option {if (!isset($returns) && $w.warehouse_id == $order.warehouse_id) || (isset($returns) && $returns.in_id == $w.warehouse_id)}selected{/if} value="{$w.warehouse_id}">{$w.name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">退货渠道</label>
                <div class="layui-input-block">
                    <select name="channel_id" lay-search>
                        <option value="">请选择</option>
                        {foreach $channel as $c}
                        <option {if isset($returns) && $returns.channel_id == $c.channel_id}selected{/if} value="{$c.channel_id}">{$c.channel_name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">追踪号</label>
                <div class="layui-input-block">
                    <input type="text" name="track_num" value="{if isset($returns)}{$returns.track_num}{/if}" class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label xrequired">退货运费</label>
                <div class="layui-input-block">
                    <input type="number" name="logistics_price" value="{if isset($returns)}{$returns.logistics_price|abs}{/if}" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-row" style="margin-top: 30px;">
            <div class="layui-col-xs3">
                <label class="layui-form-label xrequired">币种</label>
                <div class="layui-input-block">
                    <select name="currency" lay-search>
                        <option value="">请选择</option>
                        {foreach $currencies as $k => $v}
                        <option {if (isset($returns) && $returns.currency == $k) || (!isset($returns) && $order.currency == $k)}selected{/if} value="{$k}">{$v}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">备注信息</label>
                <div class="layui-input-block">
                    <input type="text" name="remark" value="{if isset($returns)}{$returns.remark}{/if}" class="layui-input">
                </div>
            </div>
        </div>
    </div>
    <div class="info-body">
        <div class="layui-row" style="margin-top: 30px;">
            <h2>商品详情</h2>
            <table class="layui-table text-center">
                <thead>
                <tr>
                    <th width="100">图片</th>
                    <th width="150">SKU</th>
                    <th>购买数量</th>
                    <th>单价</th>
                    <th width="150">退货数量</th>
                    <th>备注</th>
                </tr>
                </thead>
                <tbody>
                {foreach $order->detail as $detail}
                <tr>
                    <td><img src="{$detail.image_url}"></td>
                    <td>
                        <span class="copy-text">{$detail.sku}</span>
                        <input type="hidden" value="{$detail.sku}" name="sku[]">
                    </td>
                    <td width="150">{$detail.qty}</td>
                    <td width="150">{$detail.price|abs}</td>
                    <td><input type="number" value="{$detail.return_qty?:$detail.qty}" name="return_qty[]" class="layui-input"></td>
                    <td>{$detail.remark}</td>
                </tr>
                {/foreach}
                </tbody>
            </table>
        </div>
    </div>
</form>
{/block}
{block name="script"}
{/block}